package top.datacluster.basic.algorithm.leetcode.stack;

public class LeetCode1381 {

    private int[] data;

    private int size;

    public LeetCode1381(int maxSize) {
        data = new int[maxSize];
        size = -1;
    }

    public void push(int x) {
        if (size + 1 < data.length ){
            size++;
            data[size] = x;
        }

    }

    public int pop() {
        if (size != -1){
            return data[size--];
        }else{
            return -1;
        }
    }

    public void increment(int k, int val) {
        if (size != -1){
            int i = 0;
            while (i < k && i <= size){
                data[i] += val;
                i++;
            }
        }

    }
}
